using System;
using UnityEngine;
using QFramework;

namespace Survivor
{
	public partial class CameraController : ViewController
	{
		public float SmoothMoveTime = 1f;
		private Vector2 _followSpeed = Vector2.one;
		public bool isSmooth = true;
		void Start()
		{
			// Code Here
		}

		private void LateUpdate()
		{
			if (Player.Default)
			{
				if (isSmooth)
				{
					Vector2 nextPosition = Vector2.SmoothDamp(transform.position,
						Player.Default.transform.position, ref _followSpeed, SmoothMoveTime);
					transform.position = new Vector3(nextPosition.x, nextPosition.y, transform.position.z);
				}
				else
				{
					transform.position = new Vector3(Player.Default.transform.position.x,
						Player.Default.transform.position.y, transform.position.z);
				}
			}
		}
	}
}
